package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo01 {
    public static void main(String[] args) {
        Map<String ,Integer> map = new HashMap<>();
        Integer value = map.put("语文",99);
        System.out.println("被替换的值"+value);
        map.put("数学",98);
        map.put("英语",97);
        map.put("物理",96);
        map.put("化学",99);
        System.out.println(map);

        value = map.put("数学",66);
        System.out.println("被替换的值"+value);
        System.out.println(map);

        System.out.println(map.size());

        boolean flag = map.containsKey("数学");
        System.out.println(flag);

        flag = map.isEmpty();
        System.out.println(flag);

        Integer result = map.get("英语");
        System.out.println(result);

        Integer value2 = map.remove("数学");
        System.out.println(value2);

        map.clear();
        System.out.println(map.size());

    }

}
